<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class Psa_Plugin</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="class-name"><img src="../media/images/Class_logo.png"
														alt=" Class"
														title=" Class"
														style="vertical-align: middle"> Psa_Plugin</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
													<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
						|											<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Class that provides information about registered plugins and has methods for plugin registration process.</p>
<p class="description"><p>Information about plugins must be firstly stored (registered)in the database  with <a href="../psa/Psa_Plugin.html#methodregister">register()</a> method or by calling <a href="../psa/_register_plugins.php.html">register_plugins.php</a> script.  Plugin registration is storing information about plugins in the database,  and this should be done when new plugin class is written. If <a href="../psa/tutorial_psa_features.pkg.html#developmode">develop mode</a> is on,  registration is done on every request for convenience that you don't need manually  register if you add some plugin class.  Read more about plugins <a href="../psa/tutorial_psa_features.pkg.html#plugins">here</a>.</p><p>This class implements <a href="http://en.wikipedia.org/wiki/Singleton_pattern">singleton pattern</a>  so you can get reference to result object from any scope with  <a href="../psa/Psa_Plugin.html#methodget_instance">get_instance()</a> method. You cannot make instance of Psa_Plugin object with  <var>new</var> operator.</p><p>Information about plugins must be available on every request. So, to not query the database  on every request you can store this data into session. See <a href="../psa/Psa_Plugin.html#methodsession_restore">session_restore()</a> method.</p></p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../psa/_register_plugins.php.html">register_plugins.php</a></li>
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodregister">Psa_Plugin::register()</a></li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_scripts---Psa_Plugin.class.php.html">/scripts/Psa_Plugin.class.php</a> (line <span class="field"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a49">49</a></span>)
		</p>
		
				
		<pre>Psa_Singleton
   |
   --Psa_Plugin</pre>
	
			</div>
</div>



	<a name="sec-var-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Variable Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
						<span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
							| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
								</div>
		<div class="info-box-body">
			<div class="var-summary">
																								<div class="var-title">
					<img src="../media/images/Variable.png" alt=" " />
					<span class="var-type">array</span>
					<a href="#$plugins_data" title="details" class="var-name">$plugins_data</a>
				</div>
											</div>
		</div>
	</div>

	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
				 
				|
						<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
												<div class="method-definition">
					<img src="../media/images/StaticMethod.png" alt=" "/>
											static <span class="method-result">void</span>
										<a href="#get_instance" title="details" class="method-name">get_instance</a>
										()
									</div>
																																																																				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">array|int</span>
										<a href="#register" title="details" class="method-name">register</a>
										()
									</div>
																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int</span>
										<a href="#save" title="details" class="method-name">save</a>
											([<span class="var-type">array</span>&nbsp;<span class="var-name">$plugins_data</span> = <span class="var-default">null</span>])
									</div>
																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int</span>
										<a href="#session_restore" title="details" class="method-name">session_restore</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$serialized_data</span>)
									</div>
																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int|string</span>
										<a href="#session_save" title="details" class="method-name">session_save</a>
											(<span class="var-type">bool</span>&nbsp;<span class="var-name">$only_return</span>)
									</div>
																<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int</span>
										<a href="#set_data" title="details" class="method-name">set_data</a>
										()
									</div>
											</div>
		</div>
	</div>		

	<a name="sec-vars"></a>
	<div class="info-box">
		<div class="info-box-title">Variables</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			
<a name="var$plugins_data" id="$plugins_data"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<img src="../media/images/Variable.png" />
		<span class="var-title">
			<span class="var-type">array</span>
			<span class="var-name">$plugins_data</span>
			 = <span class="var-default">array()</span>			(line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a60">60</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Array with data about registered plugins.</p>
<p class="description"><p>This array is set with <a href="../psa/Psa_Plugin.html#methodset_data">set_data()</a> method.  Array structure is the same as array returned from <a href="../psa/Psa_Plugin.html#methodregister">register()</a> method  but without <kbd>error</kbd> element.</p></p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodregister">Psa_Plugin::register()</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	
		
		

</div>
						
		</div>
	</div>
	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
														<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methodget_instance" id="get_instance"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/StaticMethod.png" />
		<span class="method-title">static get_instance</span> (line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a86">86</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Returns object's instance.</p>
<p class="description"><p>You should statically call this method with scope resolution operator (::) which gives you  instance to the object from any scope in your application.  Example:  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$plugins&nbsp;</span>=&nbsp;<span class="src-id"><a href="../psa/Psa_Plugin.html">Psa_Plugin</a></span><span class="src-sym">::</span><a href="../psa/Psa_Plugin.html#methodget_instance">get_instance</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-php">?&gt;</span></div></li>
</ol></div></p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			get_instance
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodregister" id="register"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">register</span> (line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a301">301</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Registers plugins.</p>
<p class="description"><p>It searches for available plugin type classes (class names start with <em>Psa_Plugin_</em>)  in folders defined in <kbd>$PSA_CFG['folders']['plugin_types']</kbd> config array. The default is  <kbd>plugin_classes</kbd> folder. Then searches for classes that extends those  plugin type classes in all .php files in folders specified in <kbd>$PSA_CFG['folders']['plugins']</kbd>  config array (defined in <a href="../psa/_config.php.html">config.php</a> file) and returns array with all found plugin  files and errors. It also fills <a href="../psa/Psa_Plugin.html#var$plugins_data">$plugins_data</a> array with the same data.  Files that contain text 'PSA_SKIP_REGISTER' anywhere in content will be skipped from  registration and plugins in those files won't be registered.  <br />Returning array may look like this:<div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id"><a href="../psa/plugins/Psa_Plugin_After_User_Create.html">Psa_Plugin_After_User_Create</a></span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">My_Plugin</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><a href="http://www.php.net/file">file</a><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">My_Plugin</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id"><a href="../psa/plugins/Psa_Plugin_Controller.html">Psa_Plugin_Controller</a></span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">Default_Controller</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><a href="http://www.php.net/file">file</a><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">default_controller</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">all_plugins</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">My_Plugin</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><a href="http://www.php.net/file">file</a><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">My_Plugin</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">type</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-id"><a href="../psa/plugins/Psa_Plugin_After_User_Create.html">Psa_Plugin_After_User_Create</a></span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">Default_Controller</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><a href="http://www.php.net/file">file</a><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">default_controller</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">type</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-id"><a href="../psa/plugins/Psa_Plugin_Controller.html">Psa_Plugin_Controller</a></span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">error</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">already_registered_class_name</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">plugin</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-id"><a href="../psa/plugins/Psa_Plugin_After_User_Delete.html">Psa_Plugin_After_User_Delete</a></span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><a href="http://www.php.net/file">file</a><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">My_Plugin2</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-key">class</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-id">My_Plugin</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">conflicted_with</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">My_Plugin</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-num">4</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">plugin</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-id">Psa_Plugin_After_User_Create</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">file</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">My_Plugin3</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-key">class</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-id">My_Plugin</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">conflicted_with</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-key">var</span>/<span class="src-id">www</span>/<span class="src-id">psa</span>/<span class="src-id">plugins</span>/<span class="src-id">My_Plugin</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">all_psa_plugin_types</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;<span class="src-key">Array</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">Psa_Plugin_Controller</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-id">myapp</span>/<span class="src-id">psa</span>/<span class="src-id">plugin_classes</span>/<span class="src-id">Psa_Plugin_Controller</span>.<span class="src-key">class</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">Psa_Plugin_Model</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-id">myapp</span>/<span class="src-id">psa</span>/<span class="src-id">plugin_classes</span>/<span class="src-id">Psa_Plugin_Model</span>.<span class="src-key">class</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">Psa_Plugin_Router</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-id">myapp</span>/<span class="src-id">psa</span>/<span class="src-id">plugin_classes</span>/<span class="src-id">Psa_Plugin_Router</span>.<span class="src-key">class</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">[</span><span class="src-id">Psa_Plugin_View</span><span class="src-sym">]&nbsp;</span>=&gt;&nbsp;/<span class="src-id">myapp</span>/<span class="src-id">psa</span>/<span class="src-id">plugin_classes</span>/<span class="src-id">Psa_Plugin_View</span>.<span class="src-key">class</span>.<span class="src-id">php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-sym">)</span></div></li>
</ol></div></p></p>
	<ul class="tags">
				<li><span class="field">return:</span> array with plugin data or 0 for failure</li>
				<li><span class="field">see:</span> <a href="../psa/_config.php.html">config.php</a></li>
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodsave">Psa_Plugin::save()</a></li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">array|int</span>
		<span class="method-name">
			register
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodsave" id="save"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">save</span> (line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a508">508</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Saves data about registered plugins returned from register() method to the database.</p>
<p class="description"><p>If called without arguments it first calls <a href="../psa/Psa_Plugin.html#methodregister">register()</a> method.  Throws <a href="../psa/exceptions/Psa_Plugin_Exception.html">Psa_Plugin_Exception</a> on error.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> 1-sucess</li>
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodregister">Psa_Plugin::register()</a></li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int</span>
		<span class="method-name">
			save
		</span>
					([<span class="var-type">array</span>&nbsp;<span class="var-name">$plugins_data</span> = <span class="var-default">null</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$plugins_data</span><span class="var-description">: array returned from <a href="../psa/Psa_Plugin.html#methodregister">register()</a> method</span>			</li>
				</ul>
		
			
	</div>
<a name="methodsession_restore" id="session_restore"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">session_restore</span> (line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a192">192</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Restores object from session previously saved session_save() method.</p>
<p class="description"><p>If there is no stored object in session it calls <a href="../psa/Psa_Plugin.html#methodset_data">set_data()</a> method and then  <a href="../psa/Psa_Plugin.html#methodsession_save">session_save()</a> method so you actually need to call only this method if you want  to put <a href="../psa/Psa_Plugin.html">Psa_Plugin</a> object into session.  If <a href="../psa/tutorial_psa_features.pkg.html#developmode">develop mode</a> is on, data about plugins are always  read from database.</p><p><strong>Example:</strong></p><p><div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">//&nbsp;Router&nbsp;plugin.</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-key">class&nbsp;</span><span class="src-id">Router&nbsp;</span><span class="src-key">extends&nbsp;</span><a href="../psa/plugins/Psa_Plugin_Router.html">Psa_Plugin_Router</a><span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><span class="src-id">psa_main</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;start&nbsp;session</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/session_start">session_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;restore&nbsp;plugin&nbsp;object&nbsp;from&nbsp;session</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id"><a href="../psa/Psa_Plugin.html">Psa_Plugin</a></span><span class="src-sym">::</span><a href="../psa/Psa_Plugin.html#methodget_instance">get_instance</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">-&gt;</span><span class="src-id">session_restore</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;some&nbsp;router&nbsp;logic&nbsp;here</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-php">?&gt;</span></div></li>
</ol></div></p></p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodsession_save">Psa_Plugin::session_save()</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int</span>
		<span class="method-name">
			session_restore
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$serialized_data</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$serialized_data</span><span class="var-description">: return from <a href="../psa/Psa_Plugin.html#methodsession_save">session_save()</a></span>			</li>
				</ul>
		
			
	</div>
<a name="methodsession_save" id="session_save"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">session_save</span> (line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a143">143</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Stores object into PHP session or returns serialized representation of the Psa_Plugin object.</p>
<p class="description"><p>This is useful if you want to store complete object and to restore it on next request without  need to query the database with <a href="../psa/Psa_Plugin.html#methodset_data">set_data()</a> method.  Also, if you store object into session with this method, session variable that holds  serialized data will be updated on every call to <a href="../psa/Psa_Plugin.html#methodsave">save()</a> method.  The name of session variable will be <kbd>psa_plugins</kbd>.  PHP sessions have to be started with <kbd>session_start()</kbd> function before calling this method  otherwise throws <a href="../psa/exceptions/Psa_Plugin_Exception.html">Psa_Plugin_Exception</a>.</p></p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodsession_restore">Psa_Plugin::session_restore()</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int|string</span>
		<span class="method-name">
			session_save
		</span>
					(<span class="var-type">bool</span>&nbsp;<span class="var-name">$only_return</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">bool</span>
				<span class="var-name">$only_return</span><span class="var-description">: if true, only serialized string will be returned.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodset_data" id="set_data"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">set_data</span> (line <span class="line-number"><a href="../__filesource/fsource_psa__scriptsPsa_Plugin.class.php.html#a103">103</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Reads data about registered plugins from database and fills $plugins_data member array.</p>
<p class="description"><p><strong>Note:</strong> you don't need to call this method if you called <a href="../psa/Psa_Plugin.html#methodsave">save()</a> or <a href="../psa/Psa_Plugin.html#methodregister">register()</a>  method before cause <a href="../psa/Psa_Plugin.html#methodregister">register()</a> method will also fill <a href="../psa/Psa_Plugin.html#var$plugins_data">$plugins_data</a> array.  This method only reads previously saved plugins data from database.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> 1-sucess, 0-failure</li>
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodsave">Psa_Plugin::save()</a></li>
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#methodregister">Psa_Plugin::register()</a></li>
				<li><span class="field">see:</span> <a href="../psa/Psa_Plugin.html#var$plugins_data">Psa_Plugin::$plugins_data</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int</span>
		<span class="method-name">
			set_data
		</span>
				()
			</div>
	
		
			
	</div>
						
		</div>
	</div>

	
	<p class="notes" id="credit">
		Documentation generated on Thu, 21 Oct 2010 01:40:52 +0200 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
	</p>
	</div></body>
</html>